package com.design.pattern.flyweight.ticket;

import java.util.Random;

/**
 * @version 1.0
 * @author: CRM_SYSTEM
 * @date: 2022/10/18 22:13
 * @Description:
 */
public class TrainTicket implements ITicket {

    private String from;
    private String to;

    private int price;


    public TrainTicket(String from, String to) {
        this.from = from;
        this.to = to;
    }

    @Override
    public void showInfo(String bunk) {
        this.price = new Random().nextInt(500);
        System.out.println(from + "->" + to + ":" + bunk + "价格：" + price);
    }
}
